home *** CD-ROM | disk | FTP | other *** search
/ Champak 66 / Vol 66.iso / games / bob_espo.swf / scripts / __Packages / Instructions.as < prev    next >
Text File  |  2013-04-24  |  3KB  |  89 lines

  1. class Instructions extends State
  2. {
  3.    static var sSTATE_IDLE = "Idle";
  4.    static var sSTATE_SHOW = "ShowScreen";
  5.    function Instructions(_mcRef)
  6.    {
  7.       super(_mcRef,false);
  8.       this.nInstructionsPage = 1;
  9.       this.setState(Instructions.sSTATE_IDLE);
  10.    }
  11.    function doShow()
  12.    {
  13.       if(this.sState == Instructions.sSTATE_IDLE)
  14.       {
  15.          this.setState(Instructions.sSTATE_SHOW);
  16.          Main.getRef().doHide();
  17.          this.initPage();
  18.          this.mcRef.mcState.mcScreen.mcPanel.btnPlay1.onRollOver = Delegate.create(Main.getRef(),Main.getRef().rollOverButton);
  19.          this.mcRef.mcState.mcScreen.mcPanel.btnPlay1.onRelease = Delegate.create(Main.getRef(),Main.getRef().clickPlayButton);
  20.          this.mcRef.mcState.stop();
  21.       }
  22.    }
  23.    function doHide()
  24.    {
  25.       if(this.sState != Instructions.sSTATE_IDLE)
  26.       {
  27.          this.setState(Instructions.sSTATE_IDLE);
  28.          Main.getRef().doShow();
  29.       }
  30.    }
  31.    function desactivateButton(_mcButton)
  32.    {
  33.       delete _mcButton.button.onRollOver;
  34.       _mcButton.button.onRollOver = undefined;
  35.       delete _mcButton.button.onRelease;
  36.       _mcButton.button.onRelease = undefined;
  37.       _mcButton.gotoAndStop(2);
  38.    }
  39.    function activateButton(_mcButton, _onRelease)
  40.    {
  41.       _mcButton.gotoAndStop(1);
  42.       _mcButton.button.onRollOver = Delegate.create(Main.getRef(),Main.getRef().rollOverButton);
  43.       _mcButton.button.onRelease = Delegate.create(this,_onRelease);
  44.    }
  45.    function nextPage()
  46.    {
  47.       Controller.getRef().playClickSound();
  48.       this.nInstructionsPage = this.nInstructionsPage + 1;
  49.       this.initPage();
  50.    }
  51.    function previousPage()
  52.    {
  53.       Controller.getRef().playClickSound();
  54.       this.nInstructionsPage = this.nInstructionsPage - 1;
  55.       this.initPage();
  56.    }
  57.    function initPage()
  58.    {
  59.       if(this.nInstructionsPage == 1)
  60.       {
  61.          this.desactivateButton(this.mcRef.mcState.mcScreen.mcPanel.mcBack);
  62.          this.activateButton(this.mcRef.mcState.mcScreen.mcPanel.mcNext,this.nextPage);
  63.       }
  64.       else if(this.nInstructionsPage == 2)
  65.       {
  66.          this.activateButton(this.mcRef.mcState.mcScreen.mcPanel.mcBack,this.previousPage);
  67.          this.activateButton(this.mcRef.mcState.mcScreen.mcPanel.mcNext,this.nextPage);
  68.       }
  69.       else if(this.nInstructionsPage == 3)
  70.       {
  71.          this.activateButton(this.mcRef.mcState.mcScreen.mcPanel.mcBack,this.previousPage);
  72.          this.desactivateButton(this.mcRef.mcState.mcScreen.mcPanel.mcNext);
  73.       }
  74.       this.mcRef.mcState.mcScreen.mcPanel.mcPage.gotoAndStop(this.nInstructionsPage);
  75.    }
  76.    function doPause()
  77.    {
  78.    }
  79.    function doUnPause()
  80.    {
  81.    }
  82.    function Idle()
  83.    {
  84.    }
  85.    function ShowScreen()
  86.    {
  87.    }
  88. }
  89.